package com.hualude.roadsign.controller;

import com.hualude.roadsign.dto.DTRequestDto;
import com.hualude.roadsign.dto.DTResponseDto;
import com.hualude.roadsign.dto.JsonMsgDto;
import com.hualude.roadsign.service.HighLeverAlarmService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
@RequestMapping("/rds_highLeverAlarm")
public class HighLeverAlarmController {

    @Resource
    private HighLeverAlarmService highLeverAlarmService;



    @ResponseBody
    @RequestMapping("getMonthCount")
    public JsonMsgDto getMonthCount(String alarmPushType, String startTime, String endTime, String orgIds, String deviceId){
        JsonMsgDto jsonMsgDto=new JsonMsgDto();
        try{
            jsonMsgDto.setIsSuccess(true);
            jsonMsgDto.setJsonData(highLeverAlarmService.getMonthCount(alarmPushType,startTime,endTime,orgIds,deviceId));
        }catch (Exception e){
            jsonMsgDto.setIsSuccess(false);
            e.printStackTrace();
        }
        return jsonMsgDto;
    }


    @ResponseBody
    @RequestMapping("showAlarmHistory")
    public DTResponseDto showAlarmHistory(DTRequestDto dtRequestDto, String deviceId, Integer deviceType, String orgIds, String time){
        DTResponseDto dtResponseDto=null;
        try{
            dtResponseDto=highLeverAlarmService.showAlarmHistory(dtRequestDto,deviceId,deviceType,orgIds,time);
        }catch (Exception e){
            e.printStackTrace();
        }
        return dtResponseDto;
    }
}
